<?php


namespace App\Repositories;


use App\Models\CustomerLog as Model;
use LTools\Repositories\RepositoryAbstract;

class CustomerLog extends RepositoryAbstract
{
    /**
     * CustomerLog constructor.
     * @param Model $model
     */
    public function __construct(Model $model)
    {
        $this->model = $model;
    }

    /**
     * @param array $attributes
     * @return bool|\Illuminate\Database\Eloquent\Model
     */
    public function create(array $attributes = [])
    {
        $attributes['user_id'] = auth('customer')->user()->getKey();
        $attributes['method'] = request()->getMethod();
        if (null !== $qs = request()->getQueryString()) {
            $qs = '?'.$qs;
        }
        $attributes['name'] = request()->getPathInfo() . $qs;
        return parent::create($attributes);
    }
}
